Optimal. Leaf size=41 \[ \frac {\tanh ^{-1}(\sin (x))}{a}-\frac {\sqrt {b} \tanh ^{-1}\left (\frac {\sqrt {b} \sin (x)}{\sqrt {a+b}}\right )}{a \sqrt {a+b}} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.04, antiderivative size = 41, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.308, Rules used = {3265, 400, 212,
214} \begin {gather*} \frac {\tanh ^{-1}(\sin (x))}{a}-\frac {\sqrt {b} \tanh ^{-1}\left (\frac {\sqrt {b} \sin (x)}{\sqrt {a+b}}\right )}{a \sqrt {a+b}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 212
Rule 214
Rule 400
Rule 3265
Rubi steps
\begin {align*} \int \frac {\sec (x)}{a+b \cos ^2(x)} \, dx &=\text {Subst}\left (\int \frac {1}{\left (1-x^2\right ) \left (a+b-b x^2\right )} \, dx,x,\sin (x)\right )\\ &=\frac {\text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\sin (x)\right )}{a}-\frac {b \text {Subst}\left (\int \frac {1}{a+b-b x^2} \, dx,x,\sin (x)\right )}{a}\\ &=\frac {\tanh ^{-1}(\sin (x))}{a}-\frac {\sqrt {b} \tanh ^{-1}\left (\frac {\sqrt {b} \sin (x)}{\sqrt {a+b}}\right )}{a \sqrt {a+b}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(93\) vs. \(2(41)=82\).
time = 0.16, size = 93, normalized size = 2.27 \begin {gather*} \frac {-2 \log \left (\cos \left (\frac {x}{2}\right )-\sin \left (\frac {x}{2}\right )\right )+2 \log \left (\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )\right )+\frac {\sqrt {b} \left (\log \left (\sqrt {a+b}-\sqrt {b} \sin (x)\right )-\log \left (\sqrt {a+b}+\sqrt {b} \sin (x)\right )\right )}{\sqrt {a+b}}}{2 a} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.13, size = 47, normalized size = 1.15
method | result | size |
default | \(\frac {\ln \left (\sin \left (x \right )+1\right )}{2 a}-\frac {b \arctanh \left (\frac {b \sin \left (x \right )}{\sqrt {\left (a +b \right ) b}}\right )}{a \sqrt {\left (a +b \right ) b}}-\frac {\ln \left (\sin \left (x \right )-1\right )}{2 a}\) | \(47\) |
risch | \(-\frac {\ln \left ({\mathrm e}^{i x}-i\right )}{a}+\frac {\ln \left ({\mathrm e}^{i x}+i\right )}{a}+\frac {\sqrt {\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i x}-\frac {2 i \sqrt {\left (a +b \right ) b}\, {\mathrm e}^{i x}}{b}-1\right )}{2 \left (a +b \right ) a}-\frac {\sqrt {\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i x}+\frac {2 i \sqrt {\left (a +b \right ) b}\, {\mathrm e}^{i x}}{b}-1\right )}{2 \left (a +b \right ) a}\) | \(115\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.48, size = 64, normalized size = 1.56 \begin {gather*} \frac {b \log \left (\frac {b \sin \left (x\right ) - \sqrt {{\left (a + b\right )} b}}{b \sin \left (x\right ) + \sqrt {{\left (a + b\right )} b}}\right )}{2 \, \sqrt {{\left (a + b\right )} b} a} + \frac {\log \left (\sin \left (x\right ) + 1\right )}{2 \, a} - \frac {\log \left (\sin \left (x\right ) - 1\right )}{2 \, a} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.42, size = 119, normalized size = 2.90 \begin {gather*} \left [\frac {\sqrt {\frac {b}{a + b}} \log \left (-\frac {b \cos \left (x\right )^{2} + 2 \, {\left (a + b\right )} \sqrt {\frac {b}{a + b}} \sin \left (x\right ) - a - 2 \, b}{b \cos \left (x\right )^{2} + a}\right ) + \log \left (\sin \left (x\right ) + 1\right ) - \log \left (-\sin \left (x\right ) + 1\right )}{2 \, a}, \frac {2 \, \sqrt {-\frac {b}{a + b}} \arctan \left (\sqrt {-\frac {b}{a + b}} \sin \left (x\right )\right ) + \log \left (\sin \left (x\right ) + 1\right ) - \log \left (-\sin \left (x\right ) + 1\right )}{2 \, a}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\sec {\left (x \right )}}{a + b \cos ^{2}{\left (x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.41, size = 57, normalized size = 1.39 \begin {gather*} \frac {b \arctan \left (\frac {b \sin \left (x\right )}{\sqrt {-a b - b^{2}}}\right )}{\sqrt {-a b - b^{2}} a} + \frac {\log \left (\sin \left (x\right ) + 1\right )}{2 \, a} - \frac {\log \left (-\sin \left (x\right ) + 1\right )}{2 \, a} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 2.50, size = 414, normalized size = 10.10 \begin {gather*} \frac {\mathrm {atanh}\left (\sin \left (x\right )\right )}{a}+\frac {\mathrm {atan}\left (\frac {\frac {\left (2\,b^3\,\sin \left (x\right )+\frac {\left (2\,a^2\,b^2-\frac {\sin \left (x\right )\,\left (8\,a^3\,b^2+16\,a^2\,b^3\right )\,\sqrt {b\,\left (a+b\right )}}{4\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}\,1{}\mathrm {i}}{a^2+b\,a}+\frac {\left (2\,b^3\,\sin \left (x\right )-\frac {\left (2\,a^2\,b^2+\frac {\sin \left (x\right )\,\left (8\,a^3\,b^2+16\,a^2\,b^3\right )\,\sqrt {b\,\left (a+b\right )}}{4\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}\,1{}\mathrm {i}}{a^2+b\,a}}{\frac {\left (2\,b^3\,\sin \left (x\right )+\frac {\left (2\,a^2\,b^2-\frac {\sin \left (x\right )\,\left (8\,a^3\,b^2+16\,a^2\,b^3\right )\,\sqrt {b\,\left (a+b\right )}}{4\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{a^2+b\,a}-\frac {\left (2\,b^3\,\sin \left (x\right )-\frac {\left (2\,a^2\,b^2+\frac {\sin \left (x\right )\,\left (8\,a^3\,b^2+16\,a^2\,b^3\right )\,\sqrt {b\,\left (a+b\right )}}{4\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{a^2+b\,a}}\right )\,\sqrt {b\,\left (a+b\right )}\,1{}\mathrm {i}}{a^2+b\,a} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________